class Solution {
public:
    int removeElement(vector<int>& nums, int val) {
        if (nums.size() <= 1)
            return 1;

        int slow = 0;
        for (int fast = 0; fast < nums.size(); ++fast)
        {
            if (nums[fast] != val)
                nums[slow++] = nums[fast];
        }

        return slow ;
    }
};